package com.Junit;

import org.junit.*;

/**
 * @ClassName TestUserService
 * @Description 测试类
 * @Author 2214361854
 * @Date 2022/3/4 14:34
 * @Version 1.0
 */
public class TestUserService {
    @Before
    public void before(){
        System.out.println("======before执行=======");
    }

    @After
    public void after(){
        System.out.println("======after执行=======");
    }

    @BeforeClass
    public static void beforeClass(){
        System.out.println("======beforeClass执行=======");
    }

    @AfterClass
    public static void afterClass(){
        System.out.println("======afterClass执行=======");
    }

    /**
     * 测试方法
     * 1、必须是公开，无参，无返
     * 2、必须使用 @Test 注解标记
     */
    @Test
    public void testLoginName(){
        UserService userService = new UserService();
        String rs = userService.loginName("admin", "123456");
        //断言
        Assert.assertEquals("业务可能有问题","登录成功",rs);
    }

    @Test
    public void testSelectNames(){
        UserService userService = new UserService();
        userService.selectNames();
    }
}
